package com.shrcl.engineerprocess.domain.impl;

import com.shrcl.engineerprocess.domain.EngineerCostEstimation;
import com.shrcl.engineerprocess.domain.EngineerCostEstimationCriteria;
import com.shrcl.engineerprocess.domain.EngineerCostEstimationStatus;
import edu.fudan.mylang.pf.query.HQLBasedPagedQueryCriteria;
import java.util.Collection;
import org.hibernate.Query;

public class EngineerCostEstimationCriteriaImpl extends HQLBasedPagedQueryCriteria<EngineerCostEstimation> implements EngineerCostEstimationCriteria {
  private String info;
  
  public String getInfo() {
    return this.info;
  }
  
  public EngineerCostEstimationCriteria setInfo(final String info) {
    this.info = info;
    return this;			
    
  }
  
  private Collection<EngineerCostEstimationStatus> mulstatus;
  
  public Collection<EngineerCostEstimationStatus> getMulstatus() {
    return this.mulstatus;
  }
  
  public EngineerCostEstimationCriteria setMulstatus(final Collection<EngineerCostEstimationStatus> mulstatus) {
    this.mulstatus = mulstatus;
    return this;			
    
  }
  
  protected String buildHQLFrom() {
    return " from com.shrcl.engineerprocess.domain.impl.EngineerCostEstimationImpl this ";
  }
  
  protected String buildHQLBody() {
    String hql = "where 1 = 1 ";
    if( !edu.fudan.mylang.pf.query.QueryUtil.isNull(getInfo()) && !edu.fudan.mylang.pf.query.QueryUtil.isNull(getInfo()) ){
    	hql += " and ((this.requestInfo.projectName  LIKE :info) or (this.requestInfo.contact  LIKE :info))" ;
    }
    if( !edu.fudan.mylang.pf.query.QueryUtil.isNull(getMulstatus()) ){
    	hql += " and (this.Status  IN (:mulstatus))" ;
    }
    return hql;
    
  }
  
  public void initOrderBys() {
    
  }
  
  protected void fillParameter(final Query query) {
    if( !edu.fudan.mylang.pf.query.QueryUtil.isNull(getInfo())){
    	query.setParameter("info",getInfo()) ;
    }			
    if( !edu.fudan.mylang.pf.query.QueryUtil.isNull(getMulstatus())){
    	query.setParameterList("mulstatus",getMulstatus()) ;
    }			
    
  }
  
  protected Boolean isDistinct() {
    return false;
  }
  
  public EngineerCostEstimationCriteriaImpl() {
    initOrderBys();
  }
}
